using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class WarningLine : MonoBehaviour
{
    public GameObject Father;
    private Vector3 LastPosition;
    bool CanMove = false;
    // Start is called before the first frame update
    void Start()
    {
        Invoke("check_Line",0.1f);
    }
    void check_Line()
    {
        transform.position = Father.transform.position + Vector3.down * 1.4f;
        CanMove = true;
        LastPosition = Father.transform.position;

    }
    // Update is called once per frame
    void Update()
    {
        Move();
    }
    void Move()
    {
        if (Father != null&&CanMove)
        {
            float det_x = Father.transform.position.x - LastPosition.x;
            transform.localPosition += Vector3.right * det_x;
            LastPosition.x= Father.transform.position.x;
        }
    }
}
